<div class="data_title">《<?php echo $type_name?>》选项设置</div>
<form name="myform" action="?m=admin&c=datadictionary&a=data_list" method="post" id="myform">
<table border="0" cellpadding="0" class="main_table" style="width:70%;background:#f8f8ff;margin:5px 30px 30px 30px">
	<input type="hidden" value="<?php echo $_GET['data_type'];?>" name="data_type"></input>
	<thead>
		<tr class="main_table_header">
			<th width="4%">序号</th>
			<th width="15%">选项内容</th>
			<th width="15%">排序</th>
			<th width="10%">操    作        <a href="javascript:addItem()" title="增加"><img src="images/Rolesadd.gif"/></a></th>					
		</tr>
	</thead>
	<tbody id = "main_tbody" >
	<?php if(is_array($options)) { $k = 1; foreach ($options as $option){?>
		<tr><input type="hidden" name="option[<?php echo $k?>][data_id]" value="<?php echo $option['data_id']?>"><td><?php echo $k?></td><td><input type="text" class="txt" name="option[<?php echo $k?>][data_name]" value="<?php echo $option['data_name']?>"></input></td><td><input type="text" class="txt" name="option[<?php echo $k?>][code]" value="<?php echo $option['code']?>"></input></td><td><a href="javascript:;" onclick="descItem(this,<?php echo $k?>);" title="删除"><img src="images/view_-.gif"/></a></td></tr>
	<?php $k++; } }?>
	</tbody>
	<tr><td colspan="4"><input name="dosubmit" type="submit" class="txt_btn_a" value=" 保存 " /></td></tr>
</table>
</form>
<script type="text/javascript">
function addItem(){
	var n = $('#main_tbody ').find('input[type=text]').length/2+1;
	var newOption = '<tr><td>'+n+'</td><td><input type="text" class="txt" name="option['+n+'][data_name]"></input></td><td><input type="text" class="txt" name="option['+n+'][code]" value='+n+'></input></td><td><a href="javascript:;" onclick="descItem(this,'+n+');" title="删除"><img src="images/view_-.gif"/></a></td></tr>';
	$('#main_tbody').append(newOption);
}
function descItem(a,id){
	$(a).parent().parent().append('<input type="hidden" name="option['+id+'][del]" value="1"/>');
	$(a).parent().parent().fadeOut();
}
$('form').each(function(){
	var html = "<input type='hidden' name='ron_hash' value='"+ron_hash+"'>";
	$(this).append(html);
});
</script>

